package com.sso.ssocasclient.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * 类 {@code IndexController}  <br> 主控制器.
 *
 * <p>详细描述
 * <p>
 *
 * @author <a href="mailto:lz2392504@gmail.com">CN華少</a>
 * @since v1.0.0
 */
@RestController
@RequestMapping("/")
public class IndexController {

    /**
     * 主页面
     * @return
     */
    @RequestMapping(value = "/index")
    public String index(){
        return "hello sso client";
    }

    /**
     * 统一退出接口
     * @param session
     * @return
     */
    @RequestMapping(value = "/logout")
    public String logout(HttpSession session){
        session.invalidate();
        return "redirect:https://sso.cnhuashao.com/sso/logout?service=http://localhost:8080/index";
    }
}